# Contributor: Galen Abell <galen@galenabell.com>
# Maintainer: Galen Abell <galen@galenabell.com>
pkgname=dino
pkgver=0.4.3
pkgrel=1
pkgdesc="Modern Jabber/XMPP client"
url="https://dino.im"
# missing webrtc-audio-processing
arch="all !s390x !ppc64le !riscv64"
license="GPL-3.0-only"
depends="gst-plugins-good gst-plugins-good-gtk icu-data-full"
makedepends="
	cmake
	glib-dev
	glib-networking
	gpgme-dev
	gspell-dev
	gst-libav
	gst-plugins-base-dev
	gtk4.0-dev
	libadwaita-dev
	libcanberra-dev
	libgcrypt-dev
	libgee-dev
	libnice-dev
	libqrencode-dev
	libsignal-protocol-c-dev
	libsoup3-dev
	libsrtp-dev
	ninja
	sqlite-dev
	vala
	webrtc-audio-processing-dev
	"
subpackages="$pkgname-lang $pkgname-notificationsound"
source="https://github.com/dino/dino/releases/download/v$pkgver/dino-$pkgver.tar.gz"

# secfixes:
#   0.4.2-r0:
#     - CVE-2023-28686
#   0.2.1-r0:
#     - CVE-2021-33896

build() {
	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_BUILD_TYPE=None \
		-DBUILD_TESTS="$(want_check && echo ON || echo OFF)" \
		-DENABLED_PLUGINS="notification-sound" \
		-DUSE_SOUP3=yes
	cmake --build build
}

check() {
	build/xmpp-vala-test
	build/signal-protocol-vala-test
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

notificationsound() {
	amove usr/lib/dino/plugins/notification-sound.so
}

sha512sums="
c3e5e3ba05d7190206a8a3144002eac94f162525ab229edd420215eff3d5644293d0c8737266f0ed9f112313b2e6e83fb02fcc10d0f568fb5b2295238ebe78ea  dino-0.4.3.tar.gz
"
